package com.ref;

import org.junit.Test;

import java.io.IOException;
import java.lang.reflect.Constructor;
import java.util.Properties;

public class TestRef {
    private static Properties properties;

    static {
        properties = new Properties();
        try {
            properties.load(TestRef.class.getClassLoader().getResourceAsStream("bean.properties"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Test
    public void test() throws Exception {
        String bean = properties.getProperty("bean");
        System.out.println(bean);
        Class clazz =Class.forName(bean);
        Constructor constructor = clazz.getConstructor(null);
        System.out.println(constructor.newInstance(null));
    }
}
